package com.lanqiao.service.impl;

import com.github.pagehelper.Page;
import com.lanqiao.mapper.HouseMapper;
import com.lanqiao.service.IHouseService;
import com.lanqiao.vo.District;
import com.lanqiao.vo.House;
import com.lanqiao.vo.Street;
import com.lanqiao.vo.Types;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2018/10/4.
 */
@Service("houseService")
public class HouseServiceImpl implements IHouseService {

    @Autowired
    HouseMapper houseMapper;

    /**
     * @param house
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public List<House> selectBySelective(House house, int pageNum, int pageSize) {
        return houseMapper.selectBySelective(house,pageNum,pageSize);
    }

    @Override
    public List<District> selectDistrict() {
        return this.houseMapper.selectDistrict();
    }

    @Override
    public List<Street> selectStreetByDistrictId(Integer districtId) {
        return this.houseMapper.selectStreetByDistrictId(districtId);
    }

    @Override
    public int insert(House house) {
        return houseMapper.insert(house);
    }

    @Override
    public Page<House> selectByMe(Integer userId, Integer pageNum, int pageSize) {
        return this.houseMapper.selectByMe(userId,pageNum,pageSize);
    }

    @Override
    public House selectById(Integer hid) {
        return houseMapper.selectById(hid);
    }

    @Override
    public List<Types> selectTypes() {
        return houseMapper.selectTypes();
    }

    @Override
    public int update(House house) {
        return houseMapper.update(house);
    }

    @Override
    public int delete(Integer id) {
        return this.houseMapper.deleteById(id);
    }
}
